package com.xpp.yanpicturebackend.model.enums;

import lombok.Getter;

/**
 * 空间级别枚举
 */
@Getter
public enum SpaceLevelEnum {
    COMMON("普通版", 0, 100, 10L * 1024 ),
    PROFESSIONAL("专业版", 1, 1000, 100L * 1024 ),
    FLAGSHIP("旗舰版", 2, 10000, 10000L * 1024 * 1024 );
    private final String text;
    private final int value;
    private final long maxCount;

    private final long maxSize;

    /**
     * 创建空间级别枚举
     *
     * @param text
     * @param value
     * @param maxCount
     * @param maxSize
     */
    SpaceLevelEnum(String text, int value, long maxCount, long maxSize) {
        this.text = text;
        this.value = value;
        this.maxCount = maxCount;
        this.maxSize = maxSize;
    }

    /**
     * 根据值获取枚举
     *
     * @param value
     * @return
     */
    public static SpaceLevelEnum getEnumByValue(int value) {
        for (SpaceLevelEnum valueEnum : values()) {
            if (valueEnum.value == value) {
                return valueEnum;
            }
        }
        return null;
    }
}
